% main_fig5a_LEs.m
clear; clc; close all;

% 系统固定参数
k    = 1.77;
a    = -1;
b    = 0.1;
x0   = 0.5;
q0   = 0.5;
N_iter = 1200;      % 总迭代步数
Ndis = 200;       % 舍弃的过渡步数

% 扫描 u 范围
uVals = linspace(-2.5, 1, 501);  % 在 [-2.5, 1] 上取 501 个点
LE1   = zeros(size(uVals));      % 存放第1个李雅普诺夫指数
LE2   = zeros(size(uVals));      % 存放第2个李雅普诺夫指数

for i = 1:length(uVals)
    u = uVals(i);
    [le1, le2] = LEs2D(u, k, a, b, x0, q0, N_iter, Ndis);
    LE1(i) = le1;
    LE2(i) = le2;
end

plot(uVals, LE1, 'r-', 'LineWidth',1); hold on;
plot(uVals, LE2, 'b-', 'LineWidth',1);
xlabel('u'); ylabel('Lyapunov Exponents');
yline(0, '--k', 'LineWidth', 1.0);
title(' LEs 指数随参数 u 的变化');
legend('\lambda_1','\lambda_2','Location','best');
grid on; box on;
